<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Address Details</f:facet>

        <s:decorate id="id" template="layout/display.xhtml">
            <ui:define name="label">Id</ui:define>
            <h:outputText value="#{addressHome.instance.id}"/>
        </s:decorate>

        <s:decorate id="addressLine1" template="layout/display.xhtml">
            <ui:define name="label">Address line1</ui:define>
            <h:outputText value="#{addressHome.instance.addressLine1}"/>
        </s:decorate>

        <s:decorate id="addressLine2" template="layout/display.xhtml">
            <ui:define name="label">Address line2</ui:define>
            <h:outputText value="#{addressHome.instance.addressLine2}"/>
        </s:decorate>

        <s:decorate id="city" template="layout/display.xhtml">
            <ui:define name="label">City</ui:define>
            <h:outputText value="#{addressHome.instance.city}"/>
        </s:decorate>

        <s:decorate id="state" template="layout/display.xhtml">
            <ui:define name="label">State</ui:define>
            <h:outputText value="#{addressHome.instance.state}"/>
        </s:decorate>

        <s:decorate id="country" template="layout/display.xhtml">
            <ui:define name="label">Country</ui:define>
            <h:outputText value="#{addressHome.instance.country}"/>
        </s:decorate>

        <s:decorate id="pin" template="layout/display.xhtml">
            <ui:define name="label">Pin</ui:define>
            <h:outputText value="#{addressHome.instance.pin}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/AddressEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty addressFrom ? 'AddressList' : addressFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Teachers for present address id</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="teachersForPresentAddressIdChildren">

        <h:outputText value="There are no teachersForPresentAddressId associated with this address."
                   rendered="#{empty addressHome.teachersForPresentAddressId}"/>

        <rich:dataTable value="#{addressHome.teachersForPresentAddressId}"
                       var="_teacher"
                  rendered="#{not empty addressHome.teachersForPresentAddressId}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="teachersForPresentAddressIdTable">
            <rich:column sortBy="#{_teacher.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_teacher.id}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.firstName}">
                <f:facet name="header">First name</f:facet>
                <h:outputText value="#{_teacher.firstName}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.lastName}">
                <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{_teacher.lastName}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.passportPhotoUrl}">
                <f:facet name="header">Passport photo url</f:facet>
                <h:outputText value="#{_teacher.passportPhotoUrl}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.subject}">
                <f:facet name="header">Subject</f:facet>
                <h:outputText value="#{_teacher.subject}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.dateOfBirth}">
                <f:facet name="header">Date of birth</f:facet>
                <h:outputText value="#{_teacher.dateOfBirth}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_teacher.qualification}">
                <f:facet name="header">Qualification</f:facet>
                <h:outputText value="#{_teacher.qualification}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.mobileNumber}">
                <f:facet name="header">Mobile number</f:facet>
                <h:outputText value="#{_teacher.mobileNumber}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.contactNumberInCaseOfEmergency}">
                <f:facet name="header">Contact number in case of emergency</f:facet>
                <h:outputText value="#{_teacher.contactNumberInCaseOfEmergency}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.comments}">
                <f:facet name="header">Comments</f:facet>
                <h:outputText value="#{_teacher.comments}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectteacher"
                     value="Select"
                      view="/Teacher.xhtml">
                    <f:param name="teacherId"
                            value="#{_teacher.id}"/>
                    <f:param name="teacherFrom" value="Address"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add teacher"
                view="/TeacherEdit.xhtml">
            <f:param name="addressId"
                    value="#{addressHome.instance.id}"/>
            <f:param name="teacherFrom" value="Address"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Student previous acad detailses</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="studentPreviousAcadDetailsesChildren">

        <h:outputText value="There are no studentPreviousAcadDetailses associated with this address."
                   rendered="#{empty addressHome.studentPreviousAcadDetailses}"/>

        <rich:dataTable value="#{addressHome.studentPreviousAcadDetailses}"
                       var="_studentPreviousAcadDetails"
                  rendered="#{not empty addressHome.studentPreviousAcadDetailses}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="studentPreviousAcadDetailsesTable">
            <rich:column sortBy="#{_studentPreviousAcadDetails.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_studentPreviousAcadDetails.id}"/>
            </rich:column>
            <rich:column sortBy="#{_studentPreviousAcadDetails.courseName}">
                <f:facet name="header">Course name</f:facet>
                <h:outputText value="#{_studentPreviousAcadDetails.courseName}"/>
            </rich:column>
            <rich:column sortBy="#{_studentPreviousAcadDetails.instName}">
                <f:facet name="header">Inst name</f:facet>
                <h:outputText value="#{_studentPreviousAcadDetails.instName}"/>
            </rich:column>
            <rich:column sortBy="#{_studentPreviousAcadDetails.phone}">
                <f:facet name="header">Phone</f:facet>
                <h:outputText value="#{_studentPreviousAcadDetails.phone}"/>
            </rich:column>
            <rich:column sortBy="#{_studentPreviousAcadDetails.decription}">
                <f:facet name="header">Decription</f:facet>
                <h:outputText value="#{_studentPreviousAcadDetails.decription}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectstudentPreviousAcadDetails"
                     value="Select"
                      view="/StudentPreviousAcadDetails.xhtml">
                    <f:param name="studentPreviousAcadDetailsId"
                            value="#{_studentPreviousAcadDetails.id}"/>
                    <f:param name="studentPreviousAcadDetailsFrom" value="Address"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add studentPreviousAcadDetails"
                view="/StudentPreviousAcadDetailsEdit.xhtml">
            <f:param name="addressId"
                    value="#{addressHome.instance.id}"/>
            <f:param name="studentPreviousAcadDetailsFrom" value="Address"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Teachers for permanent address id</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="teachersForPermanentAddressIdChildren">

        <h:outputText value="There are no teachersForPermanentAddressId associated with this address."
                   rendered="#{empty addressHome.teachersForPermanentAddressId}"/>

        <rich:dataTable value="#{addressHome.teachersForPermanentAddressId}"
                       var="_teacher"
                  rendered="#{not empty addressHome.teachersForPermanentAddressId}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="teachersForPermanentAddressIdTable">
            <rich:column sortBy="#{_teacher.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_teacher.id}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.firstName}">
                <f:facet name="header">First name</f:facet>
                <h:outputText value="#{_teacher.firstName}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.lastName}">
                <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{_teacher.lastName}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.passportPhotoUrl}">
                <f:facet name="header">Passport photo url</f:facet>
                <h:outputText value="#{_teacher.passportPhotoUrl}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.subject}">
                <f:facet name="header">Subject</f:facet>
                <h:outputText value="#{_teacher.subject}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.dateOfBirth}">
                <f:facet name="header">Date of birth</f:facet>
                <h:outputText value="#{_teacher.dateOfBirth}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_teacher.qualification}">
                <f:facet name="header">Qualification</f:facet>
                <h:outputText value="#{_teacher.qualification}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.mobileNumber}">
                <f:facet name="header">Mobile number</f:facet>
                <h:outputText value="#{_teacher.mobileNumber}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.contactNumberInCaseOfEmergency}">
                <f:facet name="header">Contact number in case of emergency</f:facet>
                <h:outputText value="#{_teacher.contactNumberInCaseOfEmergency}"/>
            </rich:column>
            <rich:column sortBy="#{_teacher.comments}">
                <f:facet name="header">Comments</f:facet>
                <h:outputText value="#{_teacher.comments}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectteacher"
                     value="Select"
                      view="/Teacher.xhtml">
                    <f:param name="teacherId"
                            value="#{_teacher.id}"/>
                    <f:param name="teacherFrom" value="Address"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add teacher"
                view="/TeacherEdit.xhtml">
            <f:param name="addressId"
                    value="#{addressHome.instance.id}"/>
            <f:param name="teacherFrom" value="Address"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Parents</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="parentsChildren">

        <h:outputText value="There are no parents associated with this address."
                   rendered="#{empty addressHome.parents}"/>

        <rich:dataTable value="#{addressHome.parents}"
                       var="_parent"
                  rendered="#{not empty addressHome.parents}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="parentsTable">
            <rich:column sortBy="#{_parent.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_parent.id}"/>
            </rich:column>
            <rich:column sortBy="#{_parent.firstName}">
                <f:facet name="header">First name</f:facet>
                <h:outputText value="#{_parent.firstName}"/>
            </rich:column>
            <rich:column sortBy="#{_parent.lastName}">
                <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{_parent.lastName}"/>
            </rich:column>
            <rich:column sortBy="#{_parent.mobileNumber}">
                <f:facet name="header">Mobile number</f:facet>
                <h:outputText value="#{_parent.mobileNumber}"/>
            </rich:column>
            <rich:column sortBy="#{_parent.officePhone}">
                <f:facet name="header">Office phone</f:facet>
                <h:outputText value="#{_parent.officePhone}"/>
            </rich:column>
            <rich:column sortBy="#{_parent.email}">
                <f:facet name="header">Email</f:facet>
                <h:outputText value="#{_parent.email}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectparent"
                     value="Select"
                      view="/Parent.xhtml">
                    <f:param name="parentId"
                            value="#{_parent.id}"/>
                    <f:param name="parentFrom" value="Address"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add parent"
                view="/ParentEdit.xhtml">
            <f:param name="addressId"
                    value="#{addressHome.instance.id}"/>
            <f:param name="parentFrom" value="Address"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
